package com.demo.randomdining.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.demo.randomdining.model.TargetInfo

/**
 * Your class notes
 *
 * @author gaoguanchao
 * @since 2023/10/24 0024
 */
@Dao
interface TargetDao {
    @Insert
    fun insert(target: TargetInfo)

    @Update
    fun update(target: TargetInfo)

    @Delete
    fun delete(target: TargetInfo): Int

    @Query("DELETE FROM targetinfo")
    fun clear(): Int

    @Query("SELECT * FROM targetinfo ORDER BY targetId")
    fun getAll(): List<TargetInfo>

    @Query("SELECT * FROM targetinfo where name = :name")
    fun getInfo(name: String): List<TargetInfo>
}